package com.hlcl.huaji.ctrl.toast;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.hlcl.huaji.R;


/**
 * @author LCL 2014-11-19 setView是在项目每次启动的初始哈（多个项目引用一个类库，该一处其他地方都改变）
 */
public class SuccessToast extends Toast {
	Context ctx;

	public SuccessToast(Context context) {
		super(context);
		ctx = context;
	}

	public void setView(String msg, int gravity) {
		View layout = LayoutInflater.from(ctx).inflate(R.layout.view_toast_success, null);
		TextView txt = (TextView) layout.findViewById(R.id.txt_content);
		txt.setText(msg);
		layout.setBackgroundColor(ctx.getResources().getColor(R.color.half_trans));
		this.setView(layout);
		this.setGravity(gravity, 0, 100);
		this.show();
	}
}
